import axios from "axios";
import { consts } from "../../../tools/consts";
import { ROOT_URL } from "../../../tools/HttpClient";
const apiUrl = ROOT_URL;
const dbname = window.sessionStorage.electronParams
    ? JSON.parse(window.sessionStorage.electronParams)?.params?.DBName
    : consts.defaultDbName; // "202205188806-KH202012975";;
/**
 * 取数源设置-下拉菜单 - 行动态取数弹窗接口
 */
//  固定资产大表
export const getDisclosureApiData = async (tname, dataId, dbName, fields, where, order, queryMeta, top) => {
    try {
        const response = await axios.post(`${apiUrl}/disclosure/getDisclosureApiData`, {
            name: tname,
            data_id: dataId,
            dbName: dbname,
            fields: fields,
            where: where,
            order: order,
            queryMeta: queryMeta,
            top: top,
        });
        // console.log("333---api--", response);
        return response.data;
    }
    catch (e) {
        throw e;
    }
};
// 弹窗中 --  企业基础数据 - 取数源 接口 /disclosure/getCorpDataSrcMenu GET
export const getCorpDataSrcMenu = async () => {
    try {
        const res = await axios.get(`${apiUrl}/disclosure/getCorpDataSrcMenu`);
        return res.data;
    }
    catch (e) {
        throw e;
    }
};
// 弹窗中 -- 底稿结构化数据 - 底稿名称 /disclosure/getReportItemMenu GET
export const getReportItemMenu = async () => {
    try {
        const res = await axios.get(`${apiUrl}/disclosure/getReportItemMenu`);
        return res.data;
    }
    catch (e) {
        throw e;
    }
};
// 弹窗中 -- 底稿结构化数据 - 取数源  /disclosure/getReportDataSrcMenu POST
export const getReportDataSrcMenu = async (params) => {
    try {
        const res = await axios.post(`${apiUrl}/disclosure/getReportDataSrcMenu`, {
            ...params,
        });
        return res.data;
    }
    catch (e) {
        throw e;
    }
};
